<template>
    <div v-transfer-dom>
      <popup v-model="showRight" position="right" @on-hide="close" width="80%">
        <div id="filterPlatformBox">
          <!-- <div class="platformBox">
            <h3>平台类别</h3>
            <div id="platformClassContent" class="fliterRow1">
              <checker v-model="forms" type="radio" default-item-class="itemBox vux-1px" selected-item-class="active">
                <checker-item :value="0">{{ platformClass[0] }}</checker-item>
                <checker-item :value="1">{{ platformClass[1] }}</checker-item>
                <checker-item :value="2">{{ platformClass[2] }}</checker-item>
              </checker>
            </div>
          </div> -->
          <!-- <div class="platformBox">
            <h3>平台背景</h3>
            <checker v-model="bgs" type="radio" default-item-class="itemBox vux-1px" selected-item-class="active">
              <checker-item :value="0" style="margin-top:.3rem">{{ platformbg[0] }}</checker-item>
              <checker-item :value="1">{{ platformbg[1] }}</checker-item>
              <checker-item :value="2">{{ platformbg[2] }}</checker-item>
              <checker-item :value="3">{{ platformbg[3] }}</checker-item>
              <checker-item :value="4" style="margin:0.2933rem 0">{{ platformbg[4] }}</checker-item>
            </checker>
          </div> -->
          <div class="platformBox">
            <h3>类型</h3>
            <checker v-model="type" type="radio" default-item-class="itemBox vux-1px" selected-item-class="active">
              <checker-item value="" style="margin-top:.3rem">{{ platType[0] }}</checker-item>
              <checker-item value="pt">{{ platType[1] }}</checker-item>
              <checker-item value="zy">{{ platType[2] }}</checker-item>
              <checker-item value="jj">{{ platType[3] }}</checker-item>
              <checker-item value="bx" style="margin:0.2933rem 0">{{ platType[4] }}</checker-item>
            </checker>
          </div>
          <!-- <div class="platformBox" style="margin-top:.2rem">
            <h3>预期年化</h3>
            <checker v-model="rates" type="radio" default-item-class="itemBox vux-1px" selected-item-class="active">
              <checker-item :value="0" style="margin-top:.3rem">{{ platformYearRate[0] }}</checker-item>
              <checker-item :value="1">{{ platformYearRate[1] }}</checker-item>
              <checker-item :value="2">{{ platformYearRate[2] }}</checker-item>
              <checker-item :value="3">{{ platformYearRate[3] }}</checker-item>
              <checker-item :value="4" style="margin:0.2933rem 0">{{ platformYearRate[4] }}</checker-item>
            </checker>
          </div>
          <div class="platformBox" style="margin-top:.2rem">
            <h3>投资期限</h3>
            <checker v-model="times" type="radio" default-item-class="itemBox vux-1px" selected-item-class="active">
              <checker-item :value="0" style="margin-top:.3rem">{{ platformTime[0] }}</checker-item>
              <checker-item :value="1">{{ platformTime[1] }}</checker-item>
              <checker-item :value="2">{{ platformTime[2] }}</checker-item>
              <checker-item :value="3">{{ platformTime[3] }}</checker-item>
              <checker-item :value="4" style="margin:0.2933rem 0">{{ platformTime[4] }}</checker-item>
            </checker>
          </div> -->
          <div style="margin-top:.55rem">
            <span id="platCancle" @click="close">取消</span>
            <span id="platSubmit" @click="submit">确认</span>
          </div>
        </div>
      </popup>
    </div>
</template>
<script>
import { TransferDom,Popup,Checker,CheckerItem } from 'vux'
import {getAllcp} from '../../../../service/getData.js'
 
export default {
  components:{
    Popup,
    Checker,
    CheckerItem
  },
  data(){
    return {
      platformClass:['不限','固收','银行'],
      forms:0,
      platformbg:['不限','上市系','风投系','国资系','民营系'],
      bgs:0,
      platType:['不限','P2P','直银','基金','保险'],
      type:'',
      platformYearRate:['不限','8%以下','8%-12%','12%-16%','16%以上'],
      rates:0,
      platformTime:['不限','3个月以内','3-6个月','6-12月','12个月以上'],
      times:0,
      showRight:false
    }
  },
  methods:{
    open(){
      this.showRight = true
    },
    close(){
      this.showRight = false
      this.$emit('close',false)
    },
    submit(){//TODO:修改
      console.log(`${this.forms}/${this.bgs}/${this.type}`);
      getAllcp(
          this.forms == 0?'':this.forms,
          this.bgs == 0?'':this.bgs,
          this.type)
        .then(res=>{
          console.log(res);
          if(res.status == 1){
            this.$emit('getFilter',res.cplist?res.cplist:[])
            this.showRight = false
            this.$emit('close',false)
          }
        })
    }
  },
  directives: {
    TransferDom
  },
}
</script>
<style lang="less">
  #filterPlatformBox{
    box-sizing: border-box;
    height: 100%;
    padding: 0 0.5333rem .4rem 0.53333rem;
    // background-color: springgreen;
    .platformBox{
      margin-top: .25rem;
      .fliterRow1{
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        margin-top: 0.2rem;
      }
      .itemBox{
        width: 2.1333rem;
        height: 0.8rem;
        line-height: .8rem;
        text-align: center;
        font-size: .4rem;
        display: inline-block;
        border: 1px solid #eee;
      }
      .active{
        border:1px solid #e2462d;
        color:#e2462d;
      }
    }
    #platCancle{
      display: inline-block;
      width: 2.3467rem;
      height: 1.1733rem;
      line-height: 1.1733rem;
      text-align: center;
      border: 1px solid #a1a1a1;
      border-radius: 2rem;
      font-size: .4rem;
      margin-right: 0.3rem;
    }
    #platSubmit{
      display: inline-block;
      width: 4rem;
      height: 1.1733rem;
      line-height: 1.1733rem;
      text-align: center;
      border: 1px solid #a1a1a1;
      border-radius: 2rem;
      font-size: .4rem;
      background-color: #e2462d;
      color: #fff;
    }
  }
</style>
